package cn.edu.nit.sys.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author xiaobai
 * @Date 2022/8/30 19:31
 * @Version 1.0.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_log")
public class SysLog {

    @TableId(type = IdType.ASSIGN_UUID)
    private String id;          // 日志ID
    private String operation;   // 操作人
    private String address;     // ip
    private String method;      // 接口
    private String params;      // 参数
    private String description; // 描述
    @TableField("opType")
    private String opType;      // 操作类型
    @TableField("userAgent")
    private String userAgent;   // 操作系统
    private Long time;          // 时间

    public SysLog(String username, String ip, String requestPath, String params,
                  String title, String opType, String userAgent, long currentTimeMillis) {
        this.operation = username;
        this.address = ip;
        this.method = requestPath;
        this.params = params;
        this.description = title;
        this.opType = opType;
        this.userAgent = userAgent;
        this.time = currentTimeMillis;
    }
}
